package com.itany.ems.entity;

import com.itany.ems.Util.ParameterUtil;

import java.io.Serializable;
import java.util.Arrays;

public class Emp implements Serializable {
    private int id;
    private String name;
    private double salary;
    private String gender;
    private String edu;
    private String[] hobbies;

    public String getHob(){
        StringBuffer buffer=new StringBuffer();
        if(hobbies!=null){
            for(String hobby:hobbies){
                buffer.append(hobby+",");
            }
            return buffer.substring(0,buffer.length()-1);
        }
        return null;
    }
    public void setHob(String hobbies){
        if(ParameterUtil.isNull(hobbies)){
            this.hobbies=hobbies.split(",");
        }
    }

    public Emp() {
    }

    public Emp(String name, double salary, String gender, String edu, String[] hobbies) {
        this.name = name;
        this.salary = salary;
        this.gender = gender;
        this.edu = edu;
        this.hobbies = hobbies;
    }

    @Override
    public String toString() {
        return "Emp{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", salary=" + salary +
                ", gender='" + gender + '\'' +
                ", edu='" + edu + '\'' +
                ", hobbies=" + Arrays.toString(hobbies) +
                '}';
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getEdu() {
        return edu;
    }

    public void setEdu(String edu) {
        this.edu = edu;
    }

    public String[] getHobbies() {
        return hobbies;
    }

    public void setHobbies(String[] hobbies) {
        this.hobbies = hobbies;
    }
}
